import React from 'react';
import {inject, observer} from 'mobx-react';
import {Modal} from 'antd';
import {WeaBrowser,WeaLocaleProvider} from 'ecCom';
const toJS = mobx.toJS;
const confirm = Modal.confirm
const getLabel = WeaLocaleProvider.getLabel;
@inject ('planReportViewStore')
@observer
export default class ReportShare extends React.Component {
  constructor (props) {
    super (props);
    this.state = {};
    this.store = this.props.planReportViewStore;
  }

  onShareBrowerChange = (ids, names, datas) => {
    this.store.setPlanShare (ids,datas);

  };

  openShareModal = () => {
    this.refs.share.openModal ();
  };

  render () {
    let {buttonAuth} = this.store;
    return (
      <div className="report-share">
        <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@xmh3sq`}
          ref="share"
          memorise
          title={getLabel('119','共享') }
          viewAttr={buttonAuth.share ? '2' : '1'}
          replaceDatas={toJS (this.store.resData.shareidsList)}
          type={17}
          onChange={(ids, names, datas) =>
            this.onShareBrowerChange (ids, names, datas)}
          isSingle={false}
        />
      </div>
    );
  }
}
